package com.dongdongqiang.daogenerator.sqlbuilder.postgresql;

import com.dongdongqiang.daogenerator.pojo.TableMeta;
import com.dongdongqiang.daogenerator.sqlbuilder.DeleteSQLBuilder;

/**
 * Postgresql 删除SQL构建器
 * Created by ZZB on 2017/10/19.
 */
public class PostgresqlDeleteSQLBuilder implements DeleteSQLBuilder{
    private static final String DELETE_BY_PK_FMT = "delete from {tableName} where {pkName} = ?";

    public String buildDeleteSQL(TableMeta tableMeta){
        return DELETE_BY_PK_FMT.replace("{tableName}", tableMeta.getTableName())
                .replace("{pkName}", "\""+tableMeta.getPrimaryKeyColumn().getColumnName()+"\"");
    }
}
